<?php /* Smarty version Smarty 3.1.4, created on 2012-05-07 10:31:52
         compiled from ".\templates\gallery\index.tpl" */ ?>
<?php /*%%SmartyHeaderCode:147384fa7a49889d450-23004772%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '16dfbd0510e5f50a7277d30193e9958af5694c58' => 
    array (
      0 => '.\\templates\\gallery\\index.tpl',
      1 => 1334484556,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '147384fa7a49889d450-23004772',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'title' => 0,
    'gallery_arr' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty 3.1.4',
  'unifunc' => 'content_4fa7a498afa20',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_4fa7a498afa20')) {function content_4fa7a498afa20($_smarty_tpl) {?><script language="javascript" type="text/javascript" src="js/ajaxupload.3.5.js"></script>

<script type="text/javascript">
	$(function(){
		var btnUpload=$('#upload');
		var status=$('#status');
		new AjaxUpload(btnUpload, {
			action: 'controller.php?task=addgallery',
			name: 'uploadfile',
			onSubmit: function(file, ext){
				 if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){ 
                    // extension is not allowed 
					status.text('Only JPG, PNG or GIF files are allowed');
					return false;
				}
				status.text('Uploading...');
			},
			onComplete: function(file, response){
				//On completion clear the status
				status.text('');
				//Add uploaded file to list
				if(response==="success"){
					loadPage("gallery/index");
					$("#message_area").show();
					$("#message_area").html("<span class='success'>Banner has been successfully uploaded.</span>");
					$('<li></li>').appendTo('#files').html('<img src="../images/banners/thumbs/'+file+'" alt="" width="100" height="100" /><br />').addClass('success');
				} else{
					//$('<li></li>').appendTo('#files').text(file).addClass('error');
					loadPage("gallery/index");
					$("#message_area").show();
					$("#message_area").html("<span class='error'>Sorry. Banner is already uploaded. Please select another image.</span>");
					
				}
			}
		});
		
	});

	
</script>

<div id="page-heading">
	<h1><?php echo $_smarty_tpl->tpl_vars['title']->value;?>
</h1>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td width="15%" height="100" align="center" valign="top">		
			<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
          		<tr>
            		<th align="left" class="table-header-repeat">&nbsp;</th>
          		</tr>
          		<tr>
            		<td>
            			<div id="upload">Upload File</div>
            			<!--<div id="browsegallery" onclick="browseAll();"><span>Browse All<span></div>    -->        	
            		</td>
          		</tr>
      		</table>
      	</td>
      	<td width="2%">&nbsp;</td>	
        <td width="68%" valign="top" align="center">
        	<span id="status" ></span>		
			<ul id="files" ></ul>			
			<?php if (!empty($_smarty_tpl->tpl_vars['gallery_arr']->value)){?>
			<div id="showimages">
				<ul id="gal_files photos">
					<?php if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1'])) unset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['name'] = 'sec1';
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['gallery_arr']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show']) {
    $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'];
    if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] == 0)
        $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show'] = false;
} else
    $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show']):

            for ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] = 1;
                 $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'];
                 $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['first']      = ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['last']       = ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total']);
?>
                                    <li><a href="../images/banners/<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['filename'];?>
"><img width="175" height="60" id="<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['gallery_id'];?>
" alt="<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['url'];?>
" alt="<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['filename'];?>
" src="../images/banners/thumbs/<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['filename'];?>
" alt="" width="100" height="100" /></a><br /><img src="images/icons/remove.png" class="cursor" onclick="delGalImage(<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['gallery_id'];?>
)" /></li>
                                    <h4><?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['url'];?>
</h4>
                                    <input onblur="updategalurl(this.id,this.value)" id="<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['gallery_id'];?>
" type="text" name="url" value="<?php echo $_smarty_tpl->tpl_vars['gallery_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['url'];?>
"  />
                                    <?php endfor; endif; ?>
				</ul>
			</div>
			<?php }else{ ?>
			<div id="showimages">Sorry. Currently gallery is empty.</div>
			<?php }?>
        </td>		
	</tr>	
</table><?php }} ?>